package com.codejob.portal.dao.impl.project;



import java.util.List;

import org.springframework.stereotype.Component;

import com.codejob.portal.dao.intf.HibernateDao;
import com.codejob.portal.entity.project.BidProject;
@Component
public class BidProjectDaoImpl extends HibernateDao<BidProject, Long> {

	public Integer getCountBidProject(Long id) {
		String hql="select b from BidProject b where b.project.id="+id;
		Long count=this.countHqlResult(hql);
		return count.intValue();
	}

	public BidProject getByUserAndProjId(Long userId, Long projId) {
		String hql="select b from BidProject b where b.project.id="+projId+" and b.bidUser.id="+userId;
		List<BidProject> bidList=this.find(hql);
		if(bidList.size()>0){
			return bidList.get(0);
		}
		return null;
	}
	
}
